package com.atguigu.guliguli.common.utils;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @author: yezi
 * @date: 2021/11/27 08:42
 **/
@Data
public class PageUtils implements Serializable {

    private static final long serialVersionUID = -6735367742060621881L;
    private int totalCount;
    private int pageSize;
    private int totalPage;
    private int currPage;
    private List<?> list;

    /**
     * 分页
     */
    public PageUtils(IPage<?> page) {
        this.list = page.getRecords();
        this.totalCount = (int) page.getTotal();
        this.currPage = (int) page.getCurrent();
        this.totalPage = (int) page.getPages();

    }
}